WDV221 Intro Javascript

Project 3 - Calculations and Textfields

Assignment 1. Create an electronic Checkbook

In this project you are going to create an electronic checkbook using Javascript. You can add amounts and withdraw amounts from your current balance.

Enter an amount:

Balance::

Instructions:

1. Create a global variable called accountBalance. Initialize it to 0.

2. Create a deposit function that will process a deposit to the account. This will add the amount entered in the Amount field to the accountBalance.

3. Create a withdraw function that will process a withdrawl from the account. This will subtract the amount entered in the Amount field from the accountBalance.

3. Create a displayBalance function that will display the current value of accountBalance in the Balance field.

4. Use the combined operators for the deposit and withdraw processes.

5. Use parseInt( ) or parseFloat( ) as needed.

 

Part IV

13-15. Create a function called randomNumber( ). The function should create a random number from 1-10. It will display the number in an alert. Use an event handler on the button below to call the function.